﻿using Domain.Entity;
using Domain.Entity.ic;
using Domain.IRepository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Application.Check_dService
{
    public class Check_dService : ICheck_dService
    {
        private readonly ICheck_dRepository check_DRepository;

        public Check_dService(ICheck_dRepository check_DRepository)
        {
            this.check_DRepository = check_DRepository;
        }

        //添加盘点明细
        public async Task<int> AddCheck_d(Check_d check_D)
        {
            return await check_DRepository.AddCheck_d(check_D);
        }

        //删除盘点明细
        public async Task<int> DeleteCheck_d(int id)
        {
            return await check_DRepository.DeleteCheck_d(id);
        }

        public async Task<FenYe<CheckTJResult>> GetCheckTJResult(FenYe<CheckTJResult> fenYe, string? proc_code, string? ic_code, string? ic_type, string? create_name, int? type_id, string? proc_primary_unit, int? wh_id, string? ic_user, string? createstartTime, string? createendTime, decimal? checkprofitNumMin, decimal? checkprofitNumMax, decimal? checklossesNumMin, decimal? checklossesNumMax, decimal? checkprofitTotalMin, decimal? checkprofitTotalMax, decimal? checklossesTotalMin, decimal? checklossesTotalMax, int[]? icStatusArray)
        {
            return await check_DRepository.GetCheckTJResult(fenYe, proc_code, ic_code, ic_type, create_name, type_id, proc_primary_unit, wh_id, ic_user, createstartTime, createendTime, checkprofitNumMin, checkprofitNumMax, checklossesNumMin, checklossesNumMax, checkprofitTotalMin, checkprofitTotalMax, checklossesTotalMin, checklossesTotalMax, icStatusArray);
        }

        //查询盘点明细
        public async Task<List<Check_d>> GetCheck_Ds(int icid)
        {
            return await check_DRepository.GetCheck_Ds(icid);
        }


        //查询盘盈盘亏明细
        public async Task<List<Check_d>> GetCheck_DsYingKui(int icid, string status)
        {
            return await check_DRepository.GetCheck_DsYingKui(icid, status);    
        }


        //修改盘点明细
        public async Task<int> UpdateCheck_d(Check_d check_D)
        {
            return await check_DRepository.UpdateCheck_d(check_D);
        }


        //修改出入库状态
        public async Task<int> UpdateStatus(string name, int status, int icid, int procid)
        {
            return await check_DRepository.UpdateStatus(name, status, icid,procid);
        }
    }
}
